<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

/**
 * Class UserCommissionDetail
 *
 * @package App\Model
 * @mixin \Eloquent
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserCommissionDetail newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserCommissionDetail newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserCommissionDetail query()
 * @property int $id
 * @property int $user_id 充值的用户id
 * @property int $relation_id 充值用户的关系用户（返佣用户）
 * @property int $relation 关系,1一级普通会员,2二级普通会员,3一级业务员,4二级业务员,5三级等以上业务员，6运营商，7城市合伙人
 * @property float|null $proportion 提成比例：例如0.02
 * @property float|null $money 返佣的金额
 * @property int $status 1表示已经返佣到给会员了
 * @property string $out_trade_no 商户订单号
 * @property \Illuminate\Support\Carbon $created_at 创建时间
 * @property \Illuminate\Support\Carbon $updated_at 创建时间
 * @property string|null $deleted_at 删除时间
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserCommissionDetail whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserCommissionDetail whereDeletedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserCommissionDetail whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserCommissionDetail whereMoney($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserCommissionDetail whereOutTradeNo($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserCommissionDetail whereProportion($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserCommissionDetail whereRelation($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserCommissionDetail whereRelationId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserCommissionDetail whereStatus($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserCommissionDetail whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserCommissionDetail whereUserId($value)
 */
class UserCommissionDetail extends Model
{
    protected $table = 'user_commission_details';

    public function insertDetail($user_id, $direct_prom_user_id, $out_trade_no, $relation, $proportion, $money)
    {
        return $this->insert([
            'user_id' => $user_id,
            'relation_id' => $direct_prom_user_id,
            'out_trade_no' => $out_trade_no,
            'relation' => $relation,
            'proportion' => $proportion,
            'money' => $money,
        ]);
    }
}
